package com.finalProject;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;


import java.util.List;


/**
 * author: Jimmmy Smile
 * date: 2021-06-02 18:55::55
 * positioan: com.finalProject
 * e-mail:jimmysmileltl@163.com
 **/
public class AdapterOfHouseprice extends ArrayAdapter {
    public final String TAG = "myadapter";
    public  AdapterOfHouseprice(Context context, int resourse, List<HousePrice> hp){
        super(context,resourse, hp);

    }
    public View getView(int position , View convertView, ViewGroup parent){
        View itemView=convertView;
        if(itemView==null){
            itemView= LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false);
        }
        HousePrice hpitem =(HousePrice)getItem(position);
        //Log.i(TAG, "getView: "+hpitem.getCity());
        TextView order =(TextView)itemView.findViewById(R.id.order);
        TextView city =(TextView)itemView.findViewById(R.id.city);
        TextView price =(TextView)itemView.findViewById(R.id.price);
        TextView rate=(TextView)itemView.findViewById(R.id.rate);
        order.setText(hpitem.getOrder());
        city.setText(hpitem.getCity());
        price.setText(hpitem.getPrice());
        rate.setText(hpitem.getRate());
        return  itemView;
    }
}

